﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace StringToBytes
{
    class FormatingFromStringToHex
    {
        private static void StringConvertToByte(string str)
        {
            byte[] bytes = Encoding.UTF8.GetBytes(str);
            for (int i = 0; i < str.Length; i++)
            {
                Console.Write("\\x{0:x2}", bytes[i]);
            }
            Console.WriteLine();
        }
        static void Main(string[] args)
        {
            string name="Hi!";
            StringConvertToByte(name);
        }
    }
}
